YARN-11160. Support getResourceProfiles, getResourceProfile API's for Federation#4540
YARN-11160. Support getResourceProfiles, getResourceProfile API's for Federation#4540goiri merged 9 commits intoapache:trunkfrom
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Can we extract some of these?
resProfiles = response.getResourceProfiles()
maxResProfiles = resProfiles.get("maximum")
There was a problem hiding this comment.
Thanks for your suggestion, I will fix it.
There was a problem hiding this comment.
Thanks for the suggestion, I will fix it.
|
🎊 +1 overall
This message was automatically generated. |
|
Hi, @goiri , Please help me review the code again, Thank you very much! |
|
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
I think in Resource or ResourceUtils there was something to add to an existing resource.
There was a problem hiding this comment.
Thanks for your suggestion, I will modify the code.
There was a problem hiding this comment.
OK, i will fix it.
|
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
As we are at it... let's make it a single line.
There was a problem hiding this comment.
I was referring to Resources.add():
There was a problem hiding this comment.
I will use the method Resource add(Resource lhs, Resource rhs), this method looks fine.
|
🎊 +1 overall
This message was automatically generated. |
| LOG.error("Unable to get resource profiles due to exception.", ex); | ||
| throw ex; | ||
| } | ||
| long stopTime = clock.getTime(); |
There was a problem hiding this comment.
Couldn't we move this and the setting inside of the try?
There was a problem hiding this comment.
code show as below:
long startTime = clock.getTime();
ClientMethod remoteMethod = new ClientMethod("getResourceProfile",
new Class[] {GetResourceProfileRequest.class}, new Object[] {request});
Collection<GetResourceProfileResponse> resourceProfile = null;
try {
resourceProfile = invokeAppClientProtocolMethod(true, remoteMethod,
GetResourceProfileResponse.class);
} catch (Exception ex) {
routerMetrics.incrGetResourceProfileFailedRetrieved();
RouterServerUtil.logAndThrowException("Unable to get resource profile due to exception.",
ex);
}
long stopTime = clock.getTime();
startTime - stopTime represents the execution time of the code fragment
I think the current way should be a little better, can this part stay as it is?
There was a problem hiding this comment.
I will remove it.
There was a problem hiding this comment.
I would extract this as:
rAdd = r1 == null ? r2 : Resources.add(r1, r2);
There was a problem hiding this comment.
This is a good idea.
|
🎊 +1 overall
This message was automatically generated. |
|
@goiri Please help to review the code again, thank you very much! I will follow up with YARN-11161. |
|
@goiri Can you help merge this pr to trunk branch? thank you very much! I will follow up with YARN-11161. |
|
@goiri thank you very much! |
YARN-11160. Support getResourceProfiles, getResourceProfile API's for Federation.